package com.sita.tboard.hitchhike.bean;

import android.text.TextUtils;

import com.sita.bike.R;
import com.sita.bike.support.GlobalContext;

/**
 * Created by xiaodong on 16/4/7.
 */
public class TicketStatus {
    public final int UNKNOWN = 0;//未知
    public final int WAITING = 1;//等待接单
    public final int CANCELED = 2;//已取消
    public final int ACCEPTED = 3;//已接单
    public final int START = 4;//行程开始
    public final int UNPAID = 5;//未付款
    public final int PAID = 6;//已付款

    private String[] statuses = new String[7];

    private static class TicketStatusHolder {
        private static TicketStatus INSTANCE = new TicketStatus();
    }

    public static TicketStatus getInstance() {
        return TicketStatusHolder.INSTANCE;
    }

    private TicketStatus() {
        statuses[UNKNOWN] = GlobalContext.getGlobalContext().getString(R.string.ticket_status_0);
        statuses[WAITING] = GlobalContext.getGlobalContext().getString(R.string.ticket_status_1);
        statuses[CANCELED] = GlobalContext.getGlobalContext().getString(R.string.ticket_status_2);
        statuses[ACCEPTED] = GlobalContext.getGlobalContext().getString(R.string.ticket_status_3);
        statuses[START] = GlobalContext.getGlobalContext().getString(R.string.ticket_status_4);
        statuses[UNPAID] = GlobalContext.getGlobalContext().getString(R.string.ticket_status_5);
        statuses[PAID] = GlobalContext.getGlobalContext().getString(R.string.ticket_status_6);
    }

    public String getStatus(int i) {
        return statuses[i];
    }

    public String getWaitingStatuses(){
        return String.valueOf(WAITING);
    }

    public String getUnFinishedStatuses(){
        return WAITING + "," + ACCEPTED + "," + START + "," + UNPAID;
    }

    public String getFinishedStatuses(){
        return String.valueOf(PAID);
    }

    public String getStatusTitle(int i){
        if (i == ACCEPTED){
            return GlobalContext.getGlobalContext().getString(R.string.ticket_status_title_3);
        }
        if (i == START){
            return GlobalContext.getGlobalContext().getString(R.string.ticket_status_title_4);
        }
        return statuses[i];
    }
}
